#include <iostream>
using namespace std;

int summ=0;

template <class T>
void subv(T a[],int m,int k);

int main() {
    int n;
    cin >> n;
    int* a = new int(n);
    int* c = new int(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    subv(a,0,n);
    cout << summ;
}

template <class T>
void subv(T a[],int m,int k) {
    if (m==k) {
        int sum=0;
        for (int i=0;i<k;i++) {
            sum+=(((i+1)*a[i])&c[m]);
        }
        summ=summ^sum;
        sum=0;
    }
    else {
        c[m]=0;
        subv(a,m+1,k);
        c[m]=1;
        subv(a,m+1,k);
    }
}